﻿using System;
using System;
using System.Windows.Data;
using System.Text;
using ReflectionStudio.Core;
using WPFExcelReport;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace ReflectionStudio.Controls
{

    /// <summary>
    /// Converter : Boolean to System.Windows.Visibility and not revert
    /// </summary>
    [ValueConversion(typeof(string), typeof(System.Windows.Visibility))]
    public class BYTE2IMGConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string imageName = "1";
            //Uri uri = new Uri("Image/A1.jpg", UriKind.Absolute);
            string address = "/ImagePackage;component/Images/0.png";
            try
            {
                //source = new BitmapImage(uri);
                imageName = value.ToString();
                //uri = new Uri("Image/" + imageName, UriKind.Absolute);
                address = "/ImagePackage;component/Images/" + imageName + ".png";
                //source = new BitmapImage(uri);
            }
            catch (Exception ex)
            {
            }
            return address;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    } 
}
